let userData = {
  data: {
    accountNo: '9000011157975',
    address: { areaId: null, street: null, cityId: null, provinceId: null },
    allergy: null,
    birthday: '1979-09-17',
    canUsePoints: 0,
    diseases: [],
    estimatedDoctorId: '719f26e6f42243ff9d376ebe5d7016a0',
    estimatedHospitalId: null,
    estimatedPickupDate: null,
    estimatedPickupDay: null,
    estimatedPickupPeriod: null,
    height: null,
    homeDelivery: 1,
    hospital: { doctorName: '全国绿a医生', areaId: '110105', cityName: '北京市', areaName: '朝阳区' },
    idCard: null,
    insurance: null,
    machineNumber: null,
    memberType: 2,
    membershipLevel: 'common',
    name: '殷小雅',
    orderMinAmount: 0,
    patientId: '06fdaa9aea1047b8be69489f957de480',
    patientType: 1,
    phone: '18611372990',
    realNameAuthenticationPassed: 0,
    selfPickUp: 0,
    sex: 1,
    signingDate: '2021-09-17 16:55:11',
    tags: [],
    weight: null
  },
  code: 0
};
const clearFieldFun = (targetObj, arr) => {
  arr.forEach((item) => {
    targetObj[item] = null;
  });
  return targetObj;
};
export const user = (type) => {
  return new Promise((res, req) => {
    let { data } = userData;
    let clearField = [];
    switch (type) {
      case 1:
        clearField = ['sex', 'birthday', 'idCard'];
        break;
      case 2:
        clearField = ['idCard'];
    }
    data = clearFieldFun(data, clearField);
    userData.data = data;
    res(userData);
  });
};
